﻿<!DOCTYPE html>

<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>生产计划</title>
    <meta name="renderer" content=padding>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/js/layui/css/layui.css" rel="stylesheet" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/X-admin/lib/layui/layui.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/Scripts/formSelect/multiSelect.js"></script>
    <script type="text/html" id="barDemo">
        
          {{# if(dType=='ncheckBar'){}}
        <a title="检验" href="javascript:;"  lay-event="qCheck" id="frmQuaCheck"><i class="layui-icon">&#xe66c;</i></a>
        {{# } else {}}
        <a title="详细" href="javascript:;" lay-event="view" id="frmView"><i class="layui-icon">&#xe615;</i></a>
        {{# }}}

    </script>
</head>
<body>
    <div class="layui-fluid" style="width:100%;">
        <div id="bDiv">
        </div>
        <div style="float:left;width:100%;">
            <div class="layui-card">

                <div class="layui-card-body" style="margin-top:5px">
                    <form class="layui-form layui-col-space5" name="qForm" id="qForm">
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="barCode" placeholder="条码编码" autocomplete="off" class="layui-input" id="barCode">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="proCode" placeholder="存货编码" autocomplete="off" class="layui-input" id="proCode">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="proName" placeholder="存货名称" autocomplete="off" class="layui-input" id="proName">
                        </div>
                        <div class="layui-inline layui-show-xs-block" >
                            <select id="chResult" name="chResult" lay-filter="sFilter">
                                <option value="">待 检</option>
                                <option value="1">已 检</option>
                                <option value="2">不 检</option>
                            </select>
                        </div>
                        <input type="hidden" name="gxCode" id="gxCode" value="FH" />
                        <input type="hidden" name="barStatus" id="barStatus" value="need-check" />
                    </form>
                </div>
          

                <div class="layui-card-body layui-table-body layui-table-main" id="layui-table-main">
                    <table class="layui-hide" id="list" lay-filter="list"></table>
                </div>
            </div>


        </div>
    </div>
</body>
</html>
<script src="~/js/framework/sysframework.js"></script>
<script src="~/js/framework/commonjs.js"></script>
<script>
    var webCode = "";

    var selectBars= "";

    $(function () {
        webCode = getUrlVariable("menuCode");
        BannerData(webCode, "bDiv");
        getTableCloums(dType);
        loadData();
    })

    function openWin() {
        InfoOpenPage("../Plan/UpdatePlanNew?dataId=0", "创建计划", "85%", "80%", true);
    }
    layui.use(['form'], function () {
        var form = layui.form;

        // 绑定下拉框更换事件
        form.on('select(sFilter)', function (data) {
            if (data.value == "") {
                dType = "ncheckBar";
            } else {
                dType = "chRl";
            }
            getTableCloums(dType);
            dUrl = "../Quality/getDataList?dataType=" + dType + "&condition=";
        });
    });
    
    var dType = "ncheckBar";
    var dUrl = "../Quality/getDataList?dataType=" + dType + "&condition=";
    /**
     * 加载数据
     * **/
    function loadData() {
 
        var  condition =JSON.stringify(FormToJson("qForm"));
        layui.use('table', function () {
            var table = layui.table;
            table.render({
                elem: '#list'
                , height: 'full-200'   //固定高度-即固定表头固定第一行首行
                , cols: eval(tCloumns)
                , done: function (res, curr, count) {
                    currPage = curr;
                    TablePowerHide();
    
                }
                , url: dUrl + condition
                , skin: 'row' //表格风格
                , even: true
                , page: true //是否显示分页
                , limits: [20, 25, 30]
                , limit: 20 //每页默认显示的数量
                , id: "list"
            });

            //监听工具条
            table.on('tool(list)', function (obj) {
                var data = obj.data;
                if (obj.event == 'qCheck') {
                    var webUrl = "../Quality/QualityCheck?crCode=&barCode=" + data.barCode;
                    var title = data.barCode + "-生产质检";
                } else if (obj.event == "view") {
                    if (data.chResult == "2") {
                        layer.msg("不检验数据无法查看详细"); return;
                    }
                    var webUrl = "../Quality/QualityCheck?barCode=" + data.checkBar + "&crCode=" + data.crCode;
                    var title = data.crCode + "-生产质检(查看)";
                }
                var nUrl = dUrl + condition;
                NewOpenPage(webUrl, title, "95%", "90%", "list", currPage, nUrl);
            });

            /**复选框**/
            table.on('checkbox(list)', function (obj) {
                var select = "";
                var checkStatus = table.checkStatus('list');
                for (var i = 0; i < checkStatus.data.length; i++) {
                    select += checkStatus.data[i].barCode + ",";
                }
                selectBars = select;

            });

        });

    }

  

    /**
     * 条码不检验
     * **/
    function sureNoCheck() {
        if (selectBars.length < 1) {
            layer.msg("您没有选择任何数据"); return;
        }
        $.ajax({
            url: "../Quality/NoCheckData",
            type: "post",
            data: { barCodes: selectBars },
            success: function (data) {
                if (data.result) {
                    layer.msg("已成功从待检列表移除");
                    loadData();
                } else {
                    layer.msg(data.message);
                }
            }
        });
    }




</script>
